package com.billiard;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;

public class BilliardWindowListener implements ComponentListener {

	GameTable gt;
	
	public BilliardWindowListener(GameTable gt) {
		this.gt = gt;
	}
	
	@Override
	public void componentResized(ComponentEvent e) {

		 Component c = (Component)e.getSource();
		 Dimension size = c.getSize();
		 
		 R.tableHeight = (int)size.getHeight()-48;
		 R.tableWidth = (int)size.getWidth()-26;
		 
		 gt.setPreferredSize(new Dimension(R.tableWidth, R.tableHeight));
	}

	@Override
	public void componentMoved(ComponentEvent e) {
		System.out.println("Component Moved");
	}

	@Override
	public void componentShown(ComponentEvent e) {
		System.out.println("Component Shown");
	}

	@Override
	public void componentHidden(ComponentEvent e) {
		System.out.println("Component hidden");
	}

}
